-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
codegen: limited support for oneOfVariant in responses #3993
Conversation
else throw new NotImplementedError("any not implemented for json libs other than circe") | ||
else | ||
throw new NotImplementedError( | ||
s"any not implemented for json libs other than circe (problematic models: ${schemasWithAny.map(_._1)})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completely unrelated, but this can be triggered by surprising things (e.g. an object containing a property that's an enum without a type) so this helps avoid banging heads on walls or keyboards.
Thank you :) |
case many => | ||
if (many.map(_.code).distinct.size != many.size) bail("Cannot construct schema for multiple responses with same status code") | ||
val oneOfs = many.map { m => | ||
val code = if (m.code == "default") "400" else m.code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could've been better I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean 200?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean, default should encompass other status codes; there's an implicit contract binding we take in our choice of code, but really this is explicitly an 'open' sort of specification.... I don't know how to express it well I'm afraid.
Adding a bit of support for oneOfVariants. Where the previous code would've generated
we would now generate
given